package org.museum.identity.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.common.util.Result;
import org.museum.identity.domain.entity.IdentityName;
import org.museum.identity.service.IdentityNameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/identityName")
public class IdentityNameController {
    @Autowired
    private IdentityNameService identityNameService;
    @PostMapping()
    public void addIdentityName(@RequestBody IdentityName identityName) {
        identityNameService.addIdentityByName(identityName);
    }

    //根据身份证获取姓名
    @GetMapping("/{identity}")
    public Result getIdentityName(@PathVariable String identity) {
        //根据身份证查询姓名
        return Result.success("查询成功",identityNameService.selectNameByIdCard(identity));
    }

}
